当前位置: 首页> 函数类别大全> round

round

对浮点数进行四舍五入
名称:round
分类:数学
所属语言:php
一句话介绍:对浮点数进行四舍五入。

定义和用法

round() 函数对浮点数进行四舍五入。

实例

<?php
echo(round(0.60));
echo(round(0.50));
echo(round(0.49));
echo(round(-4.40));
echo(round(-4.60));
?>

亲自试一试

语法

round(x,prec)
参数 描述
x 可选。规定要舍入的数字。
prec 可选。规定小数点后的位数。

说明

返回将 x 根据指定精度 prec (十进制小数点后数字的数目)进行四舍五入的结果。prec 也可以是负数或零(默认值)。

同类函数
  •  十进制转换为二进制 decbin

    decbin

    十进制转换为二进制
  •  找出最小值 min

    min

    找出最小值
  •  绝对值 abs

    abs

    绝对值
  •  十六进制转换为十进制 hexdec

    hexdec

    十六进制转换为十进制
  •  判断是否为无限值 is_infinite

    is_infinite

    判断是否为无限值
  •  二进制转换为十进制 bindec

    bindec

    二进制转换为十进制
  •  播下随机数发生器种子 srand

    srand

    播下随机数发生器种子
  •  反余弦 acos

    acos

    反余弦
热门文章